import os

class Logger:
    def __init__(self, cfg: dict):
        self.cfg = cfg
        self.log_file = os.path.join(cfg['out_dir'], 'log.txt')
        self.log_file = open(self.log_file, 'w')
    
    def log(self, message: str):
        self.log_file.write(message)
        self.log_file.write('\n')
        self.log_file.flush()
    
    def close(self):
        self.log_file.close()